package demo;

import java.util.Objects;

class Person {
    public String name;
    public int age;
    @Override
    public int hashCode() {
        return Objects.hash(name, age);
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }
}
public class Test2 {
    public static void main(String[] args) {
        Person person1 = new Person("张三",18);
        Person person2 = new Person("张三",18);
        System.out.println(person1.hashCode());
        System.out.println(person2.hashCode());
    }
}
